package com.scuec.groupfive.mapper;

import com.scuec.groupfive.entity.UserInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM users")
    List<UserInfo> getUserList();

    @Select("SELECT * FROM users WHERE user_id = #{userId}")
    UserInfo getUserById(Integer userId);

    @Update("UPDATE users SET status = #{status} WHERE user_id = #{userId}")
    int updateUserStatus(@Param("userId") Integer userId, @Param("status") Integer status);

    @Update("UPDATE users SET username = #{username}, email = #{email}, phone = #{phone}, role = #{role} WHERE user_id = #{userId}")
    int updateUserInfo(UserInfo userInfo);
}